﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data;
using System.Data.SqlClient;
using DataAccess.SqlClient;
using Model;
namespace DAL
{
  public  class DoctorDAL
    {
      /// <summary>
      /// 医生表
      /// </summary>
      /// <returns></returns>
      public static dynamic Doctorshow()
      {
          SqlQuery q = new SqlQuery
          {
              //CommandText = "select a.*,b.TypeName from Doctor a inner join DoctorType b on a.DoctorTID=b.DoctorTID",
              CommandText="  select  * from Doctor a inner join DoctorType b on a.DoctorTID=b.DoctorTID where a.dstate=1",
          };
          var dt = SqlDataAccess.ExecDataset(q).Tables[0];//连接数据库，获取医生类型表
          var list = new List<dynamic>();
          foreach (var dr in dt.Select())
          {
              list.Add(

                  new
                  {
                      DoctorID = dr.Field<Guid>("DoctorID"),
                      Dname = dr.Field<string>("Dname"),
                      InAddress = dr.Field<string>("InAddress"),
                      Content = dr.Field<string>("Content"),
                      DoctorTID = dr.Field<Guid>("DoctorTID"),
                      dstate = dr.Field<int>("dstate"),
                      TypeName = dr.Field<string>("TypeName"),
                  }
                  );
          }
          return list;
      }
    }
}
